﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package com.facebook.delegates {
    import flash.events.*;
    import flash.utils.*;
    import com.facebook.net.*;
    import flash.net.*;
    import com.facebook.session.*;
    import com.facebook.utils.*;
    import com.facebook.commands.video.*;

    public class VideoUploadDelegate extends AbstractFileUploadDelegate {

        public function VideoUploadDelegate(_arg1:FacebookCall, _arg2:WebSession){
            super(_arg1, _arg2);
        }
        override protected function getExt():String{
            return ((call as UploadVideo).ext);
        }
        override protected function getContentType():String{
            return (("Content-Type: video/" + (call as UploadVideo).ext));
        }
        override protected function sendRequest():void{
            var _local1:ByteArray;
            var _local2:URLRequest = new URLRequest(_session.rest_url);
            var _local3:Object = call.args.data;
            if ((((PlayerUtils.majorVersion == 9)) && ((_local3 is FileReference)))){
                throw (new TypeError("Uploading FileReference with Player 9 is unsupported.  Use ByteArray."));
            };
            if ((((PlayerUtils.majorVersion == 10)) && ((_local3 is FileReference)))){
                _local1 = (_local3 as FileReference)["load"]();
                fileRef = (_local3 as FileReference);
                fileRef.addEventListener(Event.COMPLETE, onFileRefComplete);
            } else {
                if ((_local3 is ByteArray)){
                    uploadByteArray((_local3 as ByteArray));
                } else {
                    throw (new Error((("Error data type " + call.args.data) + " is not supported.  Please use one of the following types:  FileReference or ByteArray.")));
                };
            };
        }

    }
}//package com.facebook.delegates 
